	<#macro context><#if request?exists>${request.getContextPath()}/<#else></#if></#macro>
   

	  
	 
	    <form  class="form-horizontal" name="editForm" id="editForm"   method="POST" onsubmit="return false;">
    	<input type="hidden" name="id" id="id" value="<#if obj?exists>${obj.id?default(0)?c}</#if>" />
 
	        <div class="form-group">
	            <label class="col-sm-3 control-label"><font color="red">*</font>组织名称：</label>
	
	            <div class="col-sm-9">
	  
	                  <input class="form-control required" type="text" name="name" id="name" value="<#if obj?exists>${obj.name?if_exists}</#if>" datatype="*1-50" nullmsg="请输入组织名称！" errormsg="1-50个字符" oninputtip="请输入组织名称！"/>
	            </div>
	        </div>
	         <div class="form-group">
	            <label class="col-sm-3 control-label">上级组织：</label>
				<#if parentModel?exists==false &&  obj?exists &&  obj.parentModel?exists >
					<#assign parentModel=obj.parentModel>
				</#if>
	            <div class="col-sm-9">
          			  	<div class="input-group"> 
		  			  		<input type="hidden" name="pId" id="pId" value='<#if parentModel?exists>${parentModel.id?c}</#if>'>
              				<input type="text"  class="form-control" name="pName" id="pName" readonly="readonly" value="<#if   parentModel?exists>${ parentModel.name?if_exists}</#if>">
					  		<span class="input-group-btn">
								<INPUT type="button" value="选 择" id="btnSelect" name="btnSelect" class="btn btn-secondary  btn-default" onclick="selectTree('pId','pName','false','true')">
		                   	 </span>
						</div>
	            </div>
	        </div>
	   
	        <div class="form-group">
	            <label class="col-sm-3 control-label">是否失效：</label>
	
	            <div class="col-sm-9">
 
                             
	              	<span  class="checkbox i-checks">
		              	<label><input name="disabled" type="checkbox" id="disabled"  value="1" <#if  obj?exists && obj.disabled?exists && obj.disabled == 1>checked</#if> /></label>
		            </span>
		           
	            </div>
	        </div>
	        
	        <div class="form-group">
	            <label class="col-sm-3 control-label">备注：</label>
	
	            <div class="col-sm-9">
	  
	                  <input class="form-control" type="text" name="memo" id="memo" value="<#if obj?exists>${obj.memo?if_exists}</#if>" datatype="*1-50" nullmsg="请输入备注！" errormsg="1-50个字符" oninputtip="请输入组织名称！"/>
	            </div>
	        </div>
            <div class="form-group">
            	<div class="col-sm-offset-3 col-sm-9">
            	    <input type="hidden" name="jumpUrl" id="jumpUrl" value='<@context/>ued/tree/menu_tree.do'>
          
            		<input type="button" class="btn btn-sm  btn-primary" id="submitBtn" value="保 存" onclick="doSave()"/>
            		  <#if (obj?exists)> 
            		  		 <button class="btn btn-sm  btn-default" id="btnAdd" onclick="doEditTree('', $('#pId').val()); return false;" type="button">新 增</button>
            		  		 <button class="btn btn-sm  btn-default" id="btnDelete" onclick="doTreeNodeDelete($('#id').val(),'<@context/>ued/tree/delete.do',$('#jumpUrl').val()+'?selectNodeId='+$('#pId').val(),'确定要删除该组织和下属组织以及相关角色吗？' ); return false;" type="button">删 除</button>
            		  		 <#if upable?exists &&upable>   
 							 <button class="btn btn-sm  btn-default" id="btnMoveUp" onclick="doTreeNodeMove(1, $('#id').val(),'<@context/>ued/tree/move.do', $('#jumpUrl').val()+'?selectNodeId='+$('#id').val() ); return false;" type="button">上 移</button>
 							 </#if>
 							 <#if downable?exists &&downable>
 							 <button class="btn btn-sm  btn-default" id="btnMoveDown" onclick="doTreeNodeMove(0, $('#id').val(),'<@context/>ued/tree/move.do',$('#jumpUrl').val()+'?selectNodeId='+$('#id').val() ); return false;" type="button">下  移</button>
 							 </#if>
				      <#else>
				      		<button class="btn btn-sm  btn-default" onclick="doTreeCancelAdd('tree', $('#pId').val()); return false;" type="button">取消</button>
				      </#if>
            	</div>
            </div>
       	</form>
       	 
  
 
<script type="text/javascript">
	function doSave(){	
	 	  
		  if(!$("#editForm").valid()){
		    	 return;
		  }
		  var options = {
  			formId : 'editForm',
			url : '<@context/>ued/tree/save.do',
			callBack : function(jsonRst) {
				if (jsonRst.status=="success") {
					 alert("保存成功");
					 window.location.href = $("#jumpUrl").val()+ "?selectNodeId=" + jsonRst.data;
				 
	      		} else {
	      			alert( "出错了！"+jsonRst.message);
	      		}
			}
		};
		comm_saveInfo(options);
	}
	
		
		
	/**
	 * 选择组织
	 *
	 * @param idName   ID文本框名称
	 * @param txtName  名称文本框名称
	 * @param isMultiple   是否多选，取值'true','false'
	 * @param includeDisabled  是否包含已失效的
	 */
	function selectTree(idName,txtName,isMultiple,includeDisabled) {
		var idVal=document.all(idName).value;
		 
		art.dialog.open(ctx + "ued/tree/select.do?isMultiple="+isMultiple+"&selectNodeId="+idVal+"&includeDisabled="+includeDisabled,{id:"orgDialog",title:"组织选择",width:"400px",height:"400px"});
	  	art.dialog.data('parentWindow',window);
	  	art.dialog.data('idName',idName);
	  	art.dialog.data('txtName',txtName);
		//设置是否多选
		if(isMultiple=="true"){
			art.dialog.data('isMultiple','true');
		}else{
			art.dialog.data('isMultiple','false');
		}
	 
	}


</script>